package br.com.jdbc.factory;

import br.com.dao.ClienteDao;
import br.com.dao.DaoFactory;
import br.com.dao.FilmeDao;
import br.com.dao.ReservaDao;
import br.com.dao.ItemDao;
import br.com.dao.LocacaoDao;
import br.com.dao.TipoMidiaDao;
import br.com.dao.util.GenericDao;
import br.com.model.Cliente;
import br.com.model.Filme;
import br.com.model.Item;
import br.com.model.Reserva;
import br.com.model.Locacao;
import br.com.model.TipoMidia;
import br.com.util.ConnectionFactory;
import java.sql.Connection;
import java.sql.SQLException;

public class JDBCDaoFactory extends DaoFactory{

    private Connection connection;

    public JDBCDaoFactory() 
    {
        try
        {
            this.connection =  ConnectionFactory.getConnection() ;
        }
        catch(SQLException e)
        {
            e.printStackTrace();
        }
    }    
   
    @Override
    public GenericDao<Cliente> getClienteDao() {
        return new ClienteDao(this.connection);
    }     

    @Override
    public GenericDao<Filme> getFilmeDao() {
        return new FilmeDao(this.connection);
    }  
    
    @Override
    public GenericDao<Item> getItemDao() {
        return new ItemDao(this.connection);
    }  
    
    @Override
    public GenericDao<Reserva> getReservaDao() {
        return new ReservaDao(this.connection);
    }    
    @Override
    public GenericDao<Locacao> getLocacaoDao() {
        return new LocacaoDao(this.connection);
    }    

    @Override
    public GenericDao<TipoMidia> getTipoMidiaDao() {
       return new TipoMidiaDao(this.connection); //To change body of generated methods, choose Tools | Templates.
    }


}
